<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>

    删除第几个：<input type="text"><button>删除</button>

    <ul>
        <li>1</li>
        <li>2</li>
        <li>3</li>
        <li>4</li>
        <li>5</li>
    </ul>

<script>
    let ul = document.querySelector("ul")
    let btn = document.querySelector("button")

    let delid = document.querySelector("input")
    btn.addEventListener("click", function() {
        // 传入的参数是需要删除的节点对象，不是序号
        ul.removeChild(ul.children[delid.value])
    })
</script>
</body>
</html>